package co.edu.uniandes.sd.interfaz;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;

public class DialogoModificacion extends JDialog implements ActionListener {

	private final static String CANCELAR = "Cancelar";
	
	private JLabel lbMensaje;
	
	private JButton btnCancelar;
	
	private InterfazCliente parent;
	
	public DialogoModificacion(InterfazCliente parent){
		super(parent,true);
		this.parent = parent;
		
		setSize(300,100);
		setLayout(new BorderLayout());
		
		btnCancelar = new JButton("Cancelar");
		btnCancelar.setActionCommand(CANCELAR);
		btnCancelar.addActionListener(this);
		add(btnCancelar,BorderLayout.SOUTH);
		lbMensaje = new JLabel();
		add(lbMensaje,BorderLayout.CENTER);
		setLocationRelativeTo(parent);
	}
	
	public void setMensaje(String msj){
		lbMensaje.setText(msj);
	}

	@Override
	public void actionPerformed(ActionEvent arg0) {
		String cmd = arg0.getActionCommand();
		if(cmd.equals(CANCELAR)){
			parent.finalizarModificacion();
			dispose();
		}
		
	}
}
